<template>
  <div flex class="coupon white-bg">
    <div class="left fmd" flex="main:center cross:center dir:top">
      <p class="money f28"><span class="fmd">￥</span>{{data.freeMoney}}</p>
      <p class="name color6 mt16">{{['生日券', '加油券', '会员券', '支付赠送券', '关注赠送券', '普通券'][data.type - 1]}}</p>
    </div>
    <span class=" line"></span>
    <div class="right pl20 rel" flex="main:center dir:top" flex-box="1">
      <p class="f15" style="color: black">{{data.title}}</p>
      <p class="text3 mt10 f12">
        <i class="iconfont icon-guize mr8"></i>
        <span v-if="data.minSpend > 0">满{{data.minSpend}}元可用</span>
        <span v-else>满任意金额可用</span>
      </p>
      <p class="text3 mt4 f12"><i class="iconfont icon-shijian mr8"></i>{{data.startDate | dateFormat('YYYY/MM/DD HH:mm')}}&nbsp;至&nbsp;{{data.endDate | dateFormat('YYYY/MM/DD HH:mm')}}</p>
      <p class="text3 mt4 f12">
        油品：
        <template v-for="i in oils" v-if="data[i[0]]">
          {{i[1]}}
        </template>
      </p>
    </div>
    <i class="iconfont icon-yishiyong state_tag orange" v-if="data.state == 2"></i>
    <i class="iconfont icon-yiguoqi state_tag gray" v-if="data.state == 3"></i>
  </div>
</template>
<script>
  export default {
    props: {
      data: {
        type: Object,
        default: {}
      }
    },
    data() {
      const rules = {}
      return {
        oils: [['use0', '0#'], ['use90', '90#'], ['use92', '92#'], ['use95', '95#'], ['use98', '98#'], ['use_10', '-10#']],
        rules
      }
    },
    computed: {},
    methods: {},
    components: {}
  }
</script>
<style type="text/scss" lang="scss" scoped>
  .fsm {
    font-size: 12px;
  }
  .coupon {
    $h: 120px;
    $color: #49a9ee;
    position: relative;
    overflow: hidden;
    border-radius: 5px;
    margin-top: 10px;
    height: $h;
    border-left: 6px solid $color;
    color: $color;
    // 实现优惠券中间的裁切线
    .line {
      $size: 4px; // 中间点直径
      $bothSize: 8px; // 两端点直径
      $length: 13; // 点总数
      $color:#f3f6ff; // 点颜色
      position: relative;
      width: $bothSize;
      overflow: hidden;
      &:before {
        position: absolute;
        top: 0;
        left: 50%;
        content: '';
        z-index: 1;
        width: $size;
        height: $size;
        background-color: $color;
        margin-top: - $size / 2;
        margin-left: - $size / 2;
        border-radius: $size / 2;
        $show: null;
        $space: $h / ($length - 1);
        @for $i from 0 to $length {
          $spread: 0;
          @if $i == 0 or $i == $length - 1 {
            $spread: ($bothSize - $size) / 2;
          }
          $show: join($show, unquote('0 #{ $i * $space } 0  #{$spread} #{$color}'), comma)
        }
        box-shadow: $show;
      }
    }
    .left {
      min-width: 110px;
      max-width: 130px;
      .money {
        span {
          margin-right: -5px;
        }
      }
    }
    .state_tag {
      position: absolute;
      top: 50%;
      margin-top: -32px;
      right: 15px;
      font-size: 64px;
      opacity: 0.8;
    }
  }
</style>
